
import React from "react";

let NewCoupons = (NewCoupons)=>{
    return class NewCouponsHoc extends React.Component{
        constructor(){
            super()
            this.state = {
                    name:'',//优惠卷名称
                    type:'',//优惠卷类型
                    youHuiJuanMoney:0,//优惠卷金额
                    dingDanMoney:0,//订单金额
                    dingDanLower:0,//订单下限
                    jiFen:0,//所需积分
                    keyword:'',//关键字
                    youHuiGoods:'',//优惠商品
                    stateDate:[],//发放日期
                    effectiveDate:[],//有效日期
            }
        }
        static displayName = 'NewCoupons'+displayName(NewCoupons)

        // 改变数据
        insertStart(data,setData){
            console.log(data,setData)
            if(setData instanceof Array){
                this.setState({[data]:setData})
            }else{
                this.setState({[data]:setData.target.value})
            }
            
        }

        // 调用改变数据
        changeData = (data)=>{
                return (e) =>this.insertStart(data,e)
            
        }



        render(){
            let temp = {
                'changeData':this.changeData,
                'methodData':this.methodData,
            }
            return(
                <NewCoupons {...temp} {...this.state}></NewCoupons>
            )
        }
    }
}

function displayName(fun){
    return fun.displayName || fun.name || 'Component'
}

export default NewCoupons